package com.yunji.order.emuns;

import lombok.Getter;

/**
 * @author : peter-zhu
 * @date : 2025/3/27 18:10
 * @description : TODO
 **/
@Getter
public enum RefundTypeEnum {
    USER(1, "用户申请退款"),
    PLATE(2, "平台主动退款");
    private final Integer code;
    private final String text;

    RefundTypeEnum(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    // 根据 code 获取枚举
    public static RefundTypeEnum fromCode(int code) {
        for (RefundTypeEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的退款状态 code：" + code);
    }
}
